﻿using System.Security.Policy;
using Abp.Application.Navigation;
using Abp.Localization;
using Abp0713Demo.Authorization;

namespace Abp0713Demo.Web
{
    /// <summary>
    /// This class defines menus for the application.
    /// It uses ABP's menu system.
    /// When you add menu items here, they are automatically appear in angular application.
    /// See Views/Layout/_TopMenu.cshtml file to know how to render menu.
    /// </summary>
    public class AdminNavigationProvider : NavigationProvider
    {

        public const string MENU_AdminMenu = "AdminMenu";
        public override void SetNavigation(INavigationProviderContext context)
        {
            var adminMenu = new MenuDefinition(MENU_AdminMenu, L("AdminMenu"));

            var dashboard = new MenuItemDefinition(
                "dashboard",
                L("工作台"),
                url: "/Admin/Application/Dashboard",
                icon: "fa fa-home",
                requiresAuthentication: true
                );
            var systemManager = new MenuItemDefinition(
                "systemManager",
                L("管理"),
                url: "#",
                icon: "fa fa-home",
                requiresAuthentication: true
                );
            var materialsManager= new MenuItemDefinition(
                "materialsManager",
                L("物料管理"),
                url: "#",
                icon: "fa fa-home",
                requiresAuthentication: true
                );
            materialsManager.AddItem(new MenuItemDefinition("materialInfoManager", L("物料基本信息"), url: "/Admin/MaterialInfoManager",
                requiresAuthentication: true));

            materialsManager.AddItem(new MenuItemDefinition("materialManager_1", L("物料质检"), url: "",
                requiresAuthentication: true));
            materialsManager.AddItem(new MenuItemDefinition("materialManager_2", L("物料领取"), url: "",
                requiresAuthentication: true));

            var chartDemo = new MenuItemDefinition(
                "chartDemo",
                L("图表示例"),
                url: "/Admin/Chart",
                icon: "fa fa-home",
                requiresAuthentication: true
                );
            adminMenu.AddItem(dashboard).AddItem(systemManager).AddItem(materialsManager).AddItem(chartDemo);
            context.Manager.Menus.Add(MENU_AdminMenu, adminMenu);
        }

        private static ILocalizableString L(string name)
        {
            return new LocalizableString(name, Abp0713DemoConsts.LocalizationSourceName);
        }
    }
}
